package appconfig

import (
	"fmt"
	"github.com/spf13/viper"
)

type appconfig struct {
	Mysql
}
type Mysql struct {
	Host     string
	Port     int
	User     string
	Password string
	Database string
}

var Config appconfig

func Init() {
	var err error
	viper.SetConfigFile("appconfig/dev.yaml")
	err = viper.ReadInConfig()
	if err != nil {
		panic(err)
	}
	err = viper.Unmarshal(&Config)
	if err != nil {
		panic(err)
	}
	//log.Printf("config: init success %+v", Config)
	//log.Printf("config: init success")
	fmt.Println(Config)
}
